#ifndef SYMBOL_H
#define SYMBOL_H

#define MAX_TOKEN_LEN 32 // 标识符最大长度

// 词法单元类型枚举
#define SYMBOL_LIST                                                            \
  SYMBOL(IDENT_SYM, "ident", "")                                               \
  SYMBOL(NUMBER_SYM, "number", "")                                             \
  SYMBOL(PLUS_SYM, "plus", "+")                                                \
  SYMBOL(MINUS_SYM, "minus", "-")                                              \
  SYMBOL(TIMES_SYM, "times", "*")                                              \
  SYMBOL(SLASH_SYM, "slash", "/")                                              \
  SYMBOL(EQL_SYM, "eql", "=")                                                  \
  SYMBOL(NEQ_SYM, "neq", "#")                                                  \
  SYMBOL(LSS_SYM, "lss", "<")                                                  \
  SYMBOL(LEQ_SYM, "leq", "<=")                                                 \
  SYMBOL(GTR_SYM, "gtr", ">")                                                  \
  SYMBOL(GEQ_SYM, "geq", ">=")                                                 \
  SYMBOL(LPAREN_SYM, "lparen", "(")                                            \
  SYMBOL(RPAREN_SYM, "rparen", ")")                                            \
  SYMBOL(COMMA_SYM, "comma", ",")                                              \
  SYMBOL(SEMICOLON_SYM, "semicolon", ";")                                      \
  SYMBOL(PERIOD_SYM, "period", ".")                                            \
  SYMBOL(BECOMES_SYM, "becomes", ":=")                                         \
  SYMBOL(BEGIN_SYM, "beginsym", "begin")                                       \
  SYMBOL(END_SYM, "endsym", "end")                                             \
  SYMBOL(IF_SYM, "ifsym", "if")                                                \
  SYMBOL(THEN_SYM, "thensym", "then")                                          \
  SYMBOL(WHILE_SYM, "whilesym", "while")                                       \
  SYMBOL(DO_SYM, "dosym", "do")                                                \
  SYMBOL(CALL_SYM, "callsym", "call")                                          \
  SYMBOL(CONST_SYM, "constsym", "const")                                       \
  SYMBOL(VAR_SYM, "varsym", "var")                                             \
  SYMBOL(PROCEDURE_SYM, "proceduresym", "procedure")                           \
  SYMBOL(READ_SYM, "readsym", "read")                                          \
  SYMBOL(WRITE_SYM, "writesym", "write")                                       \
  SYMBOL(ODD_SYM, "oddsym", "odd")                                             \
  SYMBOL(ELSE_SYM, "else", "else")                                             \
  SYMBOL(UNKNOWN_SYM, "unknown", "")

// 生成枚举类型
typedef enum {
#define SYMBOL(a, b, c) a,
  SYMBOL_LIST
#undef SYMBOL
} SymbolType;

#endif // !SYMBOL_H
